function feat = getEdgeletFeature(map, gridsz, norm_way)

%siz     =   size(map);
%xx = 1:2:(siz(2)-1);   yy =  1:2:(siz(1)-1);
%nmask   =   mask(yy,xx) + mask(yy+1,xx) + mask(yy,xx+1) + mask(yy+1,xx+1);

%'verbose',
%feat = vl_hog(im2single(map), 2*gridsz,  'numOrientations', 9) ;

% imhog = vl_hog('render', feat, 'verbose', 'numOrientations', 9) ;
% figure(2) ; clf ;  imagesc(imhog) ;
% axis image off ; colormap gray ;



if(1)
    dir1 = zeros(3,3); dir1(2,1) = -1;  dir1(2,3) = 1;  
    dir2 = zeros(3,3); dir2(1,1) = -1;  dir2(3,3) = 1;
    dir3 = zeros(3,3); dir3(1,2) = -1;  dir3(3,2) = 1;
    dir4 = zeros(3,3); dir4(1,3) = -1;  dir4(3,1) = 1;
    filters{1} = dir1;      filters{2} = dir2;
    filters{3} = dir3;      filters{4} = dir4;

    for f=1:length(filters)
        resp    = imfilter(map, filters{f});
        feat(:,:,f)    = getPolyFeature(resp, gridsz,2); 
    end    
    
    if norm_way ==1
        n = 1./(sum(abs(feat), 3)+ 1e-8);        
    elseif norm_way ==2
        n = 1./sqrt(sum(feat.^2, 3) + 1e-8);        
    end    
    
    feat = bsxfun(@times, feat, n);
end

